package com.example.tt_bells_v02;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class BellDBHelper extends SQLiteOpenHelper {
	
	static final int db_version = 1;
	
    static final int DATABASE_VERSION 		= 1;
    static final String TIMER_TABLE 		= "timer";
    
    static final String ID 					= "id";
    static final String ID_TYPE 			= "INTEGER_PRIMARY KEY";
    
    static final String BELL_TYPE			= "bell_type";
    static final String BELL_TYPE_TYPE		= "INTEGER";
    static final String BELL_ACTIONS		= "bell_actions";
    static final String BELL_ACTIONS_TYPE	= "INTEGER";
    static final String BELL_STATE			= "bell_state";
    static final String BELL_STATE_TYPE		= "INTEGER";
    
    static final String NAME_SHORT 			= "name_short"; //TODO: how to read name-string from variable itself?
    static final String NAME_SHORT_TYPE 	= "TEXT";
    static final String NAME_LONG 			= "name_long";
    static final String NAME_LONG_TYPE 		= "TEXT";
    static final String ALARM_MESSAGE 		= "alarm_message";
    static final String ALARM_MESSAGE_TYPE 	= "TEXT";
    
    static final String ICON_INDEX 			= "icon_index";
    static final String ICON_INDEX_TYPE		= "INTEGER";
    static final String SOUND_INDEX			= "sound_index";
    static final String SOUND_INDEX_TYPE	= "INTEGER";
    
    static final String ALARM_SINGLE		= "alarm_single";
    static final String ALARM_SINGLE_TYPE	= "BIGINT"; 		//save DateTime in milliseconds as BIGINT
    static final String ALARM_MULTIPLE		= "alarm_multiple";
    static final String ALARM_MULTIPLE_TYPE = "TEXT";			//save array of DateTime as text
    static final String PERIOD_START		= "period_start";
    static final String PERIOD_START_TYPE	= "BIGINT";			//also DateTime
    static final String PERIOD_SIZE			= "period_size";
    static final String PERIOD_SIZE_TYPE	= "BIGINT";			//Duration
    static final String PERIOD_NUMBER		= "period_number";
    static final String PERIOD_NUMBER_TYPE  = "INTEGER";
    
    static final String PERIOD_HOURS 		= "period_hours";
    static final String PERIOD_HOURS_TYPE	= "INTEGER";
    static final String PERIOD_MINUTES 		= "period_minutes";
    static final String PERIOD_MINUTES_TYPE = "INTEGER";
    
    //TODO: sql requests
    private static final String TIMER_TABLE_CREATE =
                "CREATE TABLE " + TIMER_TABLE + " (" +
                ID+" "+ID_TYPE+", "+
                BELL_TYPE+" "+BELL_TYPE_TYPE+","+
                BELL_ACTIONS+" "+BELL_ACTIONS_TYPE+", "+
                BELL_STATE+" "+BELL_STATE_TYPE+", "+
                NAME_SHORT+" "+NAME_SHORT_TYPE+", "+
                NAME_LONG+" "+NAME_LONG_TYPE+", "+
                ALARM_MESSAGE+" "+ALARM_MESSAGE_TYPE+", "+
                ICON_INDEX+" "+ICON_INDEX_TYPE+", "+
                ");";
	
    private static final String TEMPLATE_TABLE_CREATE = "";
    
    private static final String ICONS_TABLE_CREATE = "";
    
    private static final String SOUNDS_TABLE_CREATE = "";
    
	public BellDBHelper(Context context, String db_name) {
		super(context,db_name,null,db_version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO try-catch
		db.execSQL(TIMER_TABLE_CREATE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		
	}

		
}
